<?php

 include("../../funcs/funcs.php");
 $connect=localConnectUsm();
	$today=date('Y-m-d');
		$tiaojian="";
		   if(isset($_GET['schoolcode'])&&$_GET['schoolcode']!="")
        $tiaojian.=" and schoolCode='".$_GET['schoolcode']."'";
		 if(isset($_GET['area'])&&$_GET['area']!="")
        $tiaojian.=" and area='".$_GET['area']."'";
		if(isset($_GET['sex'])&&$_GET['sex']!="")
        $tiaojian.=" and sex='".$_GET['sex']."'";
		if(isset($_GET['grade'])&&$_GET['grade']!="")
		$tiaojian.=" and grade='".$_GET['grade']."'";
		$check=false;
	if(isset($_GET['check'])){$check="and  (curRecTime<'$today'or curRecTime is NULL)";} 
  
			$sql="select count(distinct mp)as num from ".(($_GET['grade']!="")?'jianzhi':'jianzhi2')." where UseSrvID=1003 ".($check?$check:'').($tiaojian?$tiaojian:'');
			   
			 
		
	
 $query=mssql_query($sql);
 $row=mssql_fetch_array($query);
  


  echo $row['num'];


?>